<template>
  <div>
    <el-tabs type="border-card">

      <el-tab-pane>
      <span slot="label">方案发送</span>
  
      <!-- 固定项目 -->
      <el-form ref="finalOrder" :model="finalOrder" size="small" label-width="70px" class="demo-dynamic" :label-position="labelPosition" style="float: left;">
                  
                  <el-form-item label="方案名称" prop="finalOrderDesc" >
                    <el-input v-model="finalOrder.finalOrderDesc" style="width: 340px;" />
                  </el-form-item>
                  
                  <el-form-item label="方案报价" prop="finalOrderUnpaid" >
                    <el-input v-model="finalOrder.finalOrderUnpaid" style="width: 340px;" />
                  </el-form-item>
                  
               
                  <!-- <el-form-item  prop="orderFormId">
                    <el-input type="hidden" v-model="finalOrder.orderFormId" style="width: 340px;" />
                  </el-form-item> -->
                  
                  <el-button type="success" @click="submitFormfinalOrder()" plain>提交</el-button>
        </el-form>
               
    </el-tab-pane>
<!-- ---------------------------------------------------------------------------------------------- -->
      <el-tab-pane>
      <span slot="label">飞机</span>
  
      <!-- 固定项目 -->
      <el-form ref="dynamicValidate" :model="dynamicValidate" size="small" label-width="70px" class="demo-dynamic" :label-position="labelPosition" style="float: left;">
                  <h2 style="margin-left: 80px;margin-bottom: 20px;">航班信息详情</h2>
  
                  <el-form-item label="起飞机场" prop="airTicketStart" >
                    <el-input v-model="dynamicValidate.airTicketStart" style="width: 340px;" />
                  </el-form-item>
  
                  <el-form-item label="起飞时间" prop="airTicketStartTime">
                    <el-date-picker v-model="dynamicValidate.airTicketStartTime" type="datetime" style="width: 340px;" value-format="yyyy-MM-dd HH:mm:ss" />
                  </el-form-item>
  
                  <el-form-item label="降落机场" prop="airTicketEnd">
                    <el-input v-model="dynamicValidate.airTicketEnd" style="width: 340px;" />
                  </el-form-item>
                  
                  <el-form-item label="降落时间" prop="airTicketEndTime">
                    <el-date-picker v-model="dynamicValidate.airTicketEndTime" type="datetime" style="width: 340px;" value-format="yyyy-MM-dd HH:mm:ss"/>
                  </el-form-item>
                  
                  <el-form-item label="航班号" prop="airTicketAircraftNo">
                    <el-input v-model="dynamicValidate.airTicketAircraftNo" style="width: 340px;" />
                  </el-form-item>
            
                 
                  
  
                  <el-button type="success" plain @click="resetForm('dynamicValidate')" style="margin-left: 130px;"> 重 置 </el-button>
                  <el-button type="success" @click="submitFormAirDo()" plain>提交</el-button>

                  <el-form-item  prop="airTicketBy1">
                    <el-input type="hidden" v-model="dynamicValidate.airTicketBy1" style="width: 340px;" />
                  </el-form-item>
                </el-form>
  
                <template>
    <el-table 
      :data="AirData"
      style="width: auto;float: left;margin-left: 30px;">
    
      <el-table-column
        prop="airTicketAircraftNo"
        label="航班号"
        width="100">
      </el-table-column>
      <el-table-column
        prop="airTicketStart"
        label="起飞机场"
        width="140">
      </el-table-column>
      <el-table-column
        prop="airTicketStartTime"
        label="起飞时间"
        width="110">
      </el-table-column>
      <el-table-column
        prop="airTicketEnd"
        label="降落机场"
        width="140">
      </el-table-column>
      <el-table-column
        prop="airTicketEndTime"
        label="降落时间"
        width="110">
      </el-table-column>
  
      <el-table-column
        fixed="right"
        v-model="airTicketId"
        label="操作"
        width="130">
        <template slot-scope="scope">
          <el-button @click="dle(scope.row.airTicketId)" type="text" size="small" style="font-size: 19px;">移除</el-button>
          <!-- <el-button type="text" size="small" style="font-size: 19px;">编辑</el-button> -->
        </template>
      </el-table-column>
    </el-table>
  </template>
  
               
    </el-tab-pane>
    <!-- --------------------------------------------------------------------------------------- -->
<!-- y -->
    <el-tab-pane>
      <span slot="label">动车/火车</span>
   <!-- 固定项目 -->
   <el-form ref="train" :model="train" size="small" label-width="70px" class="demo-dynamic" :label-position="labelPosition" style="float: left;">
     <h2 style="margin-left: 80px">动车/火车信息详情</h2>
   
   <el-form-item label="始发站" prop="bulletTrainStart">
     <el-input v-model="train.bulletTrainStart" style="width: 340px;" />
   </el-form-item>
   
   <el-form-item label="发车时间" prop="bulletTrainStartTime">
     <el-date-picker v-model="train.bulletTrainStartTime" type="datetime" style="width: 340px;" />
   </el-form-item>
   
   <el-form-item label="终点站" prop="bulletTrainEnd">
     <el-input v-model="train.bulletTrainEnd" style="width: 340px;" />
   </el-form-item>
   
   <el-form-item label="到达时间" prop="bulletTrainEndTime">
     <el-date-picker v-model="train.bulletTrainEndTime" type="datetime" style="width: 340px;" />
   </el-form-item>
   
   <el-form-item label="车次号" prop="bulletTrainNumber">
     <el-input v-model="train.bulletTrainNumber" style="width: 340px;" />
   </el-form-item>     
                 
                   <el-button type="success" plain @click="resetForm('train')"> 重 置 </el-button>
                   <el-button type="success" @click="submitFormTrainDo()" plain>提交</el-button>

    <el-form-item  prop="bulletTrainBy1">
      <el-input type="hidden" v-model="train.bulletTrainBy1" style="width: 340px;" />
    </el-form-item>
                 </el-form>
 
                 <template>
                  
     <el-table 
       :data="trainData"
       style="width: auto;float: left;margin-left: 30px;">
     
       <el-table-column
         prop="bulletTrainNumber"
         label="车次"
         width="100">
       </el-table-column>
       <el-table-column
         prop="bulletTrainStart"
         label="始发站"
         width="140">
       </el-table-column>
       <el-table-column
         prop="bulletTrainStartTime"
         label="发车时间"
         width="110">
       </el-table-column>
       <el-table-column
         prop="bulletTrainEnd"
         label="终点站"
         width="140">
       </el-table-column>
       <el-table-column
         prop="bulletTrainEndTime"
         label="到达时间"
         width="110">
       </el-table-column>
   
       <el-table-column
         fixed="right"
         label="操作"
         width="130">
         <template slot-scope="scope">
           <el-button @click="handleClick(scope.row)" type="text" size="small" style="font-size: 19px;">移除</el-button>
           <!-- <el-button type="text" size="small" style="font-size: 19px;">编辑</el-button> -->
         </template>
       </el-table-column>
     </el-table> 
   
   </template>
   
     </el-tab-pane>
   
<!-- --------------------------------------------------------------------------------------- -->
<el-tab-pane>
  <span slot="label">车辆租赁</span>
      <el-form :model="car" size="small" label-width="70px" class="demo-dynamic" :label-position="labelPosition" style="float: left;">
                  
  
                  <h2>车辆租赁详情</h2>
   
               <el-form-item label="车辆型号" prop="carModel">
                 <el-input v-model="car.carModel" style="width: 340px;" />
               </el-form-item>
   
               <el-form-item label="车辆品牌" prop="carBrand">
                 <el-input v-model="car.carBrand" style="width: 340px;" />
               </el-form-item>
   
               <el-form-item label="座位数量" prop="carSetNum">
                 <el-input v-model="car.carSetNum" style="width: 340px;" />
               </el-form-item>
   
               <el-form-item label="租借时间" prop="carUseStartTime">
                 <el-date-picker v-model="car.carUseStartTime" type="datetime" style="width: 340px;" />
               </el-form-item>
   
               <el-form-item label="归还时间" prop="carUseEndTime">
                 <el-date-picker v-model="car.carUseEndTime" type="datetime" style="width: 340px;" />
               </el-form-item>
   
               <el-form-item label="是否需要随车司机" prop="carDriver" label-width="130px">
                  <el-radio-group v-model="car.carDriver">
                    <el-radio :label="0">需要</el-radio>
                    <el-radio :label="1">不需要</el-radio>
                  </el-radio-group>
               </el-form-item>

               <el-button type="success" plain @click="resetForm('train')"> 重 置 </el-button>
                  <el-button type="success" @click="submitFormCarDo()" plain>提交</el-button>

                <el-form-item  prop="carBy1">
                  <el-input type="hidden" v-model="car.carBy1" style="width: 340px;" />
                </el-form-item>
                 </el-form>
                 <template>
                  
                  <el-table 
                    :data="carData"
                    style="width: auto;float: left;margin-left: 30px;">
                  
                    <el-table-column
                      prop="carModel"
                      label="车辆型号"
                      width="80">
                    </el-table-column>
                    <el-table-column
                      prop="carBrand"
                      label="车辆品牌"
                      width="100">
                    </el-table-column>
                    <el-table-column
                      prop="carSetNum"
                      label="座位数量"
                      width="80">
                    </el-table-column>
                    <el-table-column
                      prop="carUseStartTime"
                      label="租借时间"
                      width="110">
                    </el-table-column>
                  
                    <el-table-column
                      prop="bulletTrainEndTime"
                      label="归还时间"
                      width="110">
                    </el-table-column>
                    <el-table-column
                    v-if="carDriver"
                      prop="carDriver"
                      label="随车司机"
                      width="80">
                    </el-table-column>
                
                    <el-table-column
                      fixed="right"
                      label="操作"
                      width="130">
                      <template slot-scope="scope">
                        <el-button @click="handleClick(scope.row)"  size="small" style="font-size: 19px;">移除</el-button>
                        <!-- <el-button size="small" style="font-size: 19px;">编辑</el-button> -->
                      </template>
                    </el-table-column>
                  </el-table> 
                
                </template>
    </el-tab-pane>
<!-- --------------------------------------------------------------------------------- -->
<el-tab-pane>
  <span slot="label">酒店</span>
      <el-form :model="car" size="small" label-width="70px" class="demo-dynamic" :label-position="labelPosition" style="float: left;">
                  
  
                  <h2>车辆租赁详情</h2>
   
               <el-form-item label="车辆型号" prop="carModel">
                 <el-input v-model="car.carModel" style="width: 340px;" />
               </el-form-item>
   
               <el-form-item label="车辆品牌" prop="carBrand">
                 <el-input v-model="car.carBrand" style="width: 340px;" />
               </el-form-item>
   
               <el-form-item label="座位数量" prop="carSetNum">
                 <el-input v-model="car.carSetNum" style="width: 340px;" />
               </el-form-item>
   
               <el-form-item label="租借时间" prop="carUseStartTime">
                 <el-date-picker v-model="car.carUseStartTime" type="datetime" style="width: 340px;" />
               </el-form-item>
   
               <el-form-item label="归还时间" prop="carUseEndTime">
                 <el-date-picker v-model="car.carUseEndTime" type="datetime" style="width: 340px;" />
               </el-form-item>
   
               <el-form-item label="是否需要随车司机" prop="carDriver" label-width="130px">
                  <el-radio-group v-model="car.carDriver">
                    <el-radio :label="0">需要</el-radio>
                    <el-radio :label="1">不需要</el-radio>
                  </el-radio-group>
               </el-form-item>

               <el-button type="success" plain @click="resetForm('train')"> 重 置 </el-button>
                  <el-button type="success" @click="submitFormCarDo()" plain>提交</el-button>

                <el-form-item  prop="carBy1">
                  <el-input type="hidden" v-model="car.carBy1" style="width: 340px;" />
                </el-form-item>
                 </el-form>
                 <!-- <template>
                  
                  <el-table 
                    :data="carData"
                    style="width: auto;float: left;margin-left: 30px;">
                  
                    <el-table-column
                      prop="carModel"
                      label="车辆型号"
                      width="80">
                    </el-table-column>
                    <el-table-column
                      prop="carBrand"
                      label="车辆品牌"
                      width="100">
                    </el-table-column>
                    <el-table-column
                      prop="carSetNum"
                      label="座位数量"
                      width="80">
                    </el-table-column>
                    <el-table-column
                      prop="carUseStartTime"
                      label="租借时间"
                      width="110">
                    </el-table-column>
                  
                    <el-table-column
                      prop="bulletTrainEndTime"
                      label="归还时间"
                      width="110">
                    </el-table-column>
                    <el-table-column
                    v-if="carDriver"
                      prop="carDriver"
                      label="随车司机"
                      width="80">
                    </el-table-column>
                 -->
                    <!-- <el-table-column
                      fixed="right"
                      label="操作"
                      width="130">
                      <template slot-scope="scope">
                        <el-button @click="handleClick(scope.row)" type="text" size="small" style="font-size: 19px;">移除</el-button>
                        <el-button type="text" size="small" style="font-size: 19px;">编辑</el-button>
                      </template>
                    </el-table-column> -->
                  <!-- </el-table>  -->
                
                <!-- </template> -->
    </el-tab-pane>
    <!-- --------------------------------------------------------------- -->
    <el-tab-pane>
  <span slot="label">餐饮</span>
      <el-form :model="car" size="small" label-width="70px" class="demo-dynamic" :label-position="labelPosition" style="float: left;">
                  
  
                  <h2>车辆租赁详情</h2>
   
               <el-form-item label="车辆型号" prop="carModel">
                 <el-input v-model="car.carModel" style="width: 340px;" />
               </el-form-item>
   
               <el-form-item label="车辆品牌" prop="carBrand">
                 <el-input v-model="car.carBrand" style="width: 340px;" />
               </el-form-item>
   
               <el-form-item label="座位数量" prop="carSetNum">
                 <el-input v-model="car.carSetNum" style="width: 340px;" />
               </el-form-item>
   
               <el-form-item label="租借时间" prop="carUseStartTime">
                 <el-date-picker v-model="car.carUseStartTime" type="datetime" style="width: 340px;" />
               </el-form-item>
   
               <el-form-item label="归还时间" prop="carUseEndTime">
                 <el-date-picker v-model="car.carUseEndTime" type="datetime" style="width: 340px;" />
               </el-form-item>
   
               <el-form-item label="是否需要随车司机" prop="carDriver" label-width="130px">
                  <el-radio-group v-model="car.carDriver">
                    <el-radio :label="0">需要</el-radio>
                    <el-radio :label="1">不需要</el-radio>
                  </el-radio-group>
               </el-form-item>

               <el-button type="success" plain @click="resetForm('train')"> 重 置 </el-button>
                  <el-button type="success" @click="submitFormCarDo()" plain>提交</el-button>

                <el-form-item  prop="carBy1">
                  <el-input type="hidden" v-model="car.carBy1" style="width: 340px;" />
                </el-form-item>
                 </el-form>
                 <!-- <template>
                  
                  <el-table 
                    :data="carData"
                    style="width: auto;float: left;margin-left: 30px;">
                  
                    <el-table-column
                      prop="carModel"
                      label="车辆型号"
                      width="80">
                    </el-table-column>
                    <el-table-column
                      prop="carBrand"
                      label="车辆品牌"
                      width="100">
                    </el-table-column>
                    <el-table-column
                      prop="carSetNum"
                      label="座位数量"
                      width="80">
                    </el-table-column>
                    <el-table-column
                      prop="carUseStartTime"
                      label="租借时间"
                      width="110">
                    </el-table-column>
                  
                    <el-table-column
                      prop="bulletTrainEndTime"
                      label="归还时间"
                      width="110">
                    </el-table-column>
                    <el-table-column
                    v-if="carDriver"
                      prop="carDriver"
                      label="随车司机"
                      width="80">
                    </el-table-column>
                 -->
                    <!-- <el-table-column
                      fixed="right"
                      label="操作"
                      width="130">
                      <template slot-scope="scope">
                        <el-button @click="handleClick(scope.row)" type="text" size="small" style="font-size: 19px;">移除</el-button>
                        <el-button type="text" size="small" style="font-size: 19px;">编辑</el-button>
                      </template>
                    </el-table-column> -->
                  <!-- </el-table>  -->
                
                <!-- </template> -->
    </el-tab-pane>
    <!-- ---------------------------------------------------------------------------- -->
    </el-tabs>
  </div>
</template>

<script>
export default {
  data() {
    return {
      airTicketBy1:this.$route.query.orderFormNo,
      // bulletTrainBy1:this.$route.query.airTicketBy1,
      finalOrder:{
        finalOrderUnpaid:'',
        finalOrderNo:''
      },
      dynamicValidate: {
        
        },
        AirData: [
           
        ],
        trainData:[

        ],
        train:{
        
        },
        carData:[

        ],
        car:{
         
        }
    };
  },
  methods: {
    submitFormfinalOrder(){
      this.finalOrder.finalOrderNo=this.airTicketBy1;
      this.$axios.put("/finally/submitFormfinalOrder",this.finalOrder).then((response) => {
            if (response.data.code == 200) {
             this.$message.success(response.data.message);
             this.finalOrder = {};
            } else {
             this.$message.error("提交失败！");
            }
          });
    },

    dle(airTicketId){
        // window.alert(airTicketId);
        this.loadAir();
        this.$axios.delete("airticket/"+airTicketId).then(responser =>{
          if(responser.data.code == 200){
            this.$message.success(response.data.message);
          }else{
            this.$message.error("移除失败！");
          }
          
        })

    },
    add(){
      this.train.bulletTrainBy1 = this.airTicketBy1;
      this.car.carBy1 = this.airTicketBy1;
    },
    loadAir(){
          
          this.airTicketBy1 = sessionStorage.getItem("t1");
          this.dynamicValidate.airTicketBy1 = this.airTicketBy1;
          // window.alert(this.airTicketBy1);
          this.$axios.get("/airticket/"+this.airTicketBy1).then(responser=> {
              this.AirData = responser.data.data.AirData
          })
          // this.add();
        },
        submitFormAirDo() {
          // window.alert(this.dynamicValidate.airTicketBy1);
          this.$axios.post("/airticket/submitFormAirDo",this.dynamicValidate).then((response) => {
            if (response.data.code == 200) {
             this.$message.success(response.data.message);
             this.dynamicValidate = {};
              this.loadAir();
            } else {
             this.$message.error("提交失败！");
            }
          });
        },


          loadTrain(){
          this.airTicketBy1 = sessionStorage.getItem("t1");
          this.dynamicValidate.airTicketBy1 = this.airTicketBy1;
          // window.alert(this.airTicketBy1);
          this.$axios.get("/bullettrain/"+this.airTicketBy1).then(responser=> {
              this.trainData = responser.data.data.AirData
          })
          this.add();
        },
        submitFormTrainDo(){
          this.$axios.put("/bullettrain/submitFormTrainDo",this.train).then((response) => {
            if (response.data.code == 200) {
             this.$message.success(response.data.message);
             this.train = {};
              this.loadTrain();
            } else {
             this.$message.error("提交失败！");
            }
          });
        },

        loadCar(){
          
          this.airTicketBy1 = sessionStorage.getItem("t1");
          this.dynamicValidate.airTicketBy1 = this.airTicketBy1;
          // window.alert(this.airTicketBy1);
          this.$axios.get("/car/"+this.airTicketBy1).then(responser=> {
              this.carData = responser.data.data.AirData
          })
          this.add();
        },
        submitFormCarDo(){
          // window.alert(this.car.carDriver)
          this.$axios.put("/car/submitFormCarDo",this.car).then((response) => {
            if (response.data.code == 200) {
             this.$message.success(response.data.message);
             this.car = {};
              this.loadCar();
            } else {
             this.$message.error("提交失败！");
            }
          });
        },




        resetForm(formName) {
          this.$refs[formName].resetFields();
        },
        addItem() {
        this.dynamicValidate.dynamicItem.push({
         
        })
      }
  },
  mounted(){
        this.loadAir();
        this.loadTrain();
        this.loadCar();
      }
};
</script>